/**
* 全站路由配置
*
* meta参数说明
* keepAlive是否缓冲页面
* isTab是否加入到tag导航
* isAuth是否需要授权
*/

console.log("---------------加载router------------------")

import Vue from 'vue'
import Router from 'vue-router'
import PageRouter from './modules/page'
import ViewsRouter from './modules/views'
import IpcRouter from './ipc-router'
import i18n from '@/lang/'
import store from '../store/'





Vue.use(Router)

/* Layout */
import Layout from '@/layout'


const createRouter = () => new Router({
  // 页面滚动监听
  scrollBehavior: () => ({ y: 0 }),
  routes: []
})

const router = createRouter()

console.log("----------router--11111111----------")
console.log(router)



setTimeout(()=>{
  console.log("-------router文件夹里的store------------")
  console.log(store)
  IpcRouter.install(Vue, router, store, i18n);
  router.$ipcRouter.formatRoutes(store.state.user.menu, true);
},0)


router.addRoutes([...PageRouter,...ViewsRouter]);


// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
/*export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher 
}*/


console.log("----------router--end--end--end------")
console.log(router)

export default router
